package com.cloud.quickcore.admin.enums;

import com.alibaba.fastjson.annotation.JSONType;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

import java.util.Objects;

/**
 * 冻结标志 --枚举类
 * @author NiJo_H
 * @version 1.0
 * @date 2019/7/28 18:57
 */
@Getter
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
@JSONType(serializeEnumAsJavaBean = true)
public enum FrozenTypenEnum {
    NO_FROZEN(0,"未冻结"),
    FROZENED(1,"冻结中无法使用");
    private Integer code;
    private String  value;

    FrozenTypenEnum(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    //获取枚举实例
    public static FrozenTypenEnum fromValue(Integer value) {
        for (FrozenTypenEnum frozenTypenEnum: FrozenTypenEnum.values()) {
            if (Objects.equals(value, frozenTypenEnum.getCode())) {
                return frozenTypenEnum;
            }
        }
        throw new IllegalArgumentException();
    }
}
